home *** CD-ROM | disk | FTP | other *** search
/ By Popular Request 2.0 / By Popular Request 2.0 (Arsenal Computer).ISO / amiga_6 / vrctr116.lha / RexxProg.rexx < prev    next >
OS/2 REXX Batch file  |  1995-08-05  |  4KB  |  103 lines

  1. /*\
  2.  *
  3.  *  $VER: 
  4.  *
  5. \*/
  6.  
  7. VersMsg = 
  8. Author  = "Dave Freeman"
  9. Contact = "dfreeman@icecave.apana.org.au"
  10.  
  11. OPTIONS RESULTS
  12.  
  13. SIGNAL ON ERROR
  14. SIGNAL ON BREAK_C
  15. SIGNAL ON SYNTAX
  16.  
  17. LibList = 'rexxsupport.library rexxdossupport.library'
  18. DO Count = 1 TO WORDS(LibList)
  19.   IF ~SHOW('l',WORD(LibList,Count)) THEN DO
  20.     IF ~ADDLIB(WORD(LibList,Count),0,-30) THEN DO
  21.       CALL GSay("Error: "WORD(LibList,Count)"not available","Damn!")
  22.       EXIT 5
  23.       END
  24.     END
  25.   END
  26.  
  27. /* ----------------------------------------------------------------------------------------------- */
  28. /* Handle Args for the Program                                                                     */
  29. /* ----------------------------------------------------------------------------------------------- */
  30.  
  31. PARSE ARG ArgString
  32. Template = "SomeText/F"
  33. IF ~ReadArgs(ArgString,Template) THEN DO
  34.   ErrorMsg = "Error: Incorrect/Incomplete Call to Script*NTemplate: "Template
  35.   CALL GSay(ErrorMsg,"OK")
  36.   END
  37.  
  38. /* ----------------------------------------------------------------------------------------------- */
  39. /* Change Variables in this section only                                                           */
  40. /* ----------------------------------------------------------------------------------------------- */
  41.  
  42. Work_Dir     = 'RT:'
  43. Temp_Dir     = 'T:'
  44.  
  45. /* ----------------------------------------------------------------------------------------------- */
  46. /* Don't Change Variables in this section                                                          */
  47. /* ----------------------------------------------------------------------------------------------- */
  48.  
  49. CSI          = '9b'x
  50. ClearLine    = CSI || F || CSI || M
  51.  
  52. /* ----------------------------------------------------------------------------------------------- */
  53. StoreDir     = PRAGMA('D')                    /* Remember Current Dir and go back there at the end */
  54. CALL PRAGMA('D',Work_Dir)
  55. /* ----------------------------------------------------------------------------------------------- */
  56.  
  57.  
  58. /* ----------------------------------------------------------------------------------------------- */
  59. CALL PRAGMA('D',StoreDir)                                    /* Return Current Dir to Original Dir */
  60. /* ----------------------------------------------------------------------------------------------- */
  61.  
  62. EXIT(0)
  63.  
  64. /* ----------------------------------------------------------------------------------------------- */
  65. /* CALL Routines start here                                                                        */
  66. /* ----------------------------------------------------------------------------------------------- */
  67.  
  68. GSay: PROCEDURE EXPOSE VersMsg               /* GSay("Message Text","Option1","Option2","OptionN") */
  69. GChoice. = 0 ; GChoiceStr = ' "'
  70. ArgCount = ARG()
  71. GTitle   = VersMsg
  72. GMessage = ARG(1)
  73. DO Count = 2 TO ArgCount
  74.   GChoiceStr    = GChoiceStr||ARG(Count)'" "'
  75.   END
  76. GChoiceStr = DELSTR(GChoiceStr,LENGTH(GChoiceStr) - 1)
  77. ADDRESS COMMAND 'RequestChoice "'GTitle'" "'GMessage'"'||GChoiceStr' >T:ChoiceRet'
  78. CALL OPEN(ChoiceIn,'T:ChoiceRet',READ)
  79. ChoiceRet = READLN(ChoiceIn)
  80. IF ChoiceRet = 0 THEN ChoiceRet = ArgCount - 1
  81. CALL CLOSE(ChoiceIn)
  82. CALL DELETE('T:ChoiceRet')
  83. RETURN(ChoiceRet)
  84.  
  85. /* ----------------------------------------------------------------------------------------------- */
  86. /* Error Handling Routines start here                                                              */
  87. /* ----------------------------------------------------------------------------------------------- */
  88.  
  89. BREAK_C:
  90.   SAY 'Break-C Signal Detected'
  91.   SAY 'Execution Ceased at line - 'SIGL
  92.   SAY 'Source Line: 'SourceLine(SIGL)
  93.   EXIT 10
  94. RETURN
  95.  
  96. ERROR:
  97. SYNTAX:
  98.   SAY 'Trapped Error: 'ErrorText(rc)
  99.   SAY 'Line 'SIGL' "'SourceLine(SIGL)'"'
  100.   EXIT 20
  101. RETURN
  102.  
  103.